﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZLCMS.Business.DwzFrame;
using DotNet.Common.Command;
using ZLCMS.Commands.User.Commands.Order;
using ZLCMS.Business.Util;
namespace ZLCMS.Web.SystemManage.Basics.Shop.Order
{
    public partial class OrderDelete : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ZLCMS.Business.DwzFrame.FrameHelper framePage = new ZLCMS.Business.DwzFrame.FrameHelper(this);
            string ids = Request["ids"];
            if (!string.IsNullOrEmpty(ids))
            {
                string[] noArr = ids.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
               

                using (NHibernate.ISession session = DotNet.Common.NHibernateUtil.SessionFactoryHelper.CreateSession())
                {
                    foreach (string no in noArr)
                    {
                        ICommandResult<DeleteOrderResult> res = new DeleteOrderCommand().Execute(session, new DeleteOrderParameter()
                        {
                            OrderNo = no,
                            UserAccount = UserKit.GetUserAccountFailLogin()
                        });
                    }
                    session.Flush();
                    framePage.Alert(new ZLCMS.Business.DwzFrame.ReturnCode() { statusCode = 200, message = "操作成功!", navTabId = framePage.NavTabId });
                }
            }
            else
            {
                framePage.Alert(new ZLCMS.Business.DwzFrame.ReturnCode() { statusCode = 300, message = "参数错误" });
            }

        }
    }
}